package com.lizhi.note.mapper;


import com.lizhi.note.dto.NotepageDTO;
import com.lizhi.note.entity.NotepageEntity;
import org.mapstruct.*;

import java.util.List;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface NotepageMapper {

    @Mapping(source = "notebookId", target = "notebook.id")
    NotepageEntity toEntity(NotepageDTO dto);

    @Mapping(source = "notebook.id", target = "notebookId")
    NotepageDTO toDto(NotepageEntity entity);

    @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
    void updateEntity(NotepageDTO dto, @MappingTarget NotepageEntity entity);

    // 列表转换方法
    List<NotepageDTO> toDtoList(List<NotepageEntity> entities);

    List<NotepageEntity> toEntityList(List<NotepageDTO> dtos);
}
